<template>
  <el-dialog v-model="dialogVisible" title="确认货物集货完毕信息" center>
    <el-form label-position="top">
      <p class="show"><strong>信息展示：</strong></p>
      <el-form-item v-for="m in result.messages" size="large" :key="m.id">
        <el-descriptions>
          <el-descriptions-item :label="m.title + ':'" class="el"
            ><el-tag size="small">{{ m.message }}</el-tag></el-descriptions-item
          >
        </el-descriptions>
      </el-form-item>
      <el-form-item label="选择安装师傅派单:">
        <el-select v-model="select" placeholder="选择安装师傅派单">
          <el-option v-for="s in result.select" :label="s.name" :value="s.name" :key="s.id" />
        </el-select>
      </el-form-item>
    </el-form>
    <div>
      <p class="show"><strong>图片展示：</strong></p>
      <el-carousel :interval="4000" type="card" height="250px">
        <el-carousel-item v-for="img in result.imgs" :key="img.id">
          <el-image id="img" style="width: 100%; height: 100%" :src="img.url" fit="fill" />
        </el-carousel-item>
      </el-carousel>
    </div>
    <div class="qButton">
      <el-button type="primary" size="large" @click="close()">确定</el-button>
    </div>
  </el-dialog>
</template>

<script lang="ts" setup>
import { reactive, ref } from 'vue';
const dialogVisible = ref(false);
const select = ref('');
const result = reactive({
  messages: [
    {
      id: 1,
      title: '信息名称',
      message: '信息值',
    },
    {
      id: 2,
      title: '信息名称',
      message: '你好',
    },
  ],
  imgs: [
    {
      id: 1,
      url: 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
    },
    {
      id: 2,
      url: 'https://fuss10.elemecdn.com/1/34/19aa98b1fcb2781c4fba33d850549jpeg.jpeg',
    },
    {
      id: 3,
      url: 'https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg',
    },
    {
      id: 4,
      url: 'https://fuss10.elemecdn.com/9/bb/e27858e973f5d7d3904835f46abbdjpeg.jpeg',
    },
  ],
  select: [
    {
      id: 1,
      name: '222',
    },
    {
      id: 2,
      name: '333',
    },
  ],
});

const close = () => {
  console.log(select.value);
  dialogVisible.value = false;
};
const open = () => {
  dialogVisible.value = true;
};
defineExpose({
  open,
});
</script>
<style scoped>
.qButton {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding-right: 50px;
}
.show {
  margin: 0px 0px 20px 0px;
}
.el-carousel__item #img {
  color: #475669;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
  text-align: center;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
</style>